//
//  UIView+frame.m
//  CBXM
//
//  Created by 本 on 16/4/3.
//  Copyright © 2016年 本. All rights reserved.
//

#import "UIView+frame.h"

@implementation UIView (frame)
+ (instancetype)AB_creatWithNib{
    return [[NSBundle mainBundle] loadNibNamed:NSStringFromClass(self) owner:nil options:nil][0];
}
- (CGFloat)centerX{
    return self.center.x;

}
- (CGFloat)centerY{
    return self.center.y;
}
- (void)setCenterX:(CGFloat)centerX{
    CGPoint point = self.center;
    point.x = centerX;
    self.center = point;
    
}
- (void)setCenterY:(CGFloat)centerY{
    CGPoint point = self.center;
    point.y = centerY;
    self.center = point;
    
}
- (CGFloat)x{
    return self.frame.origin.x;
}

- (void)setX:(CGFloat)x{
    CGRect rect = self.frame;
    rect.origin.x = x;
    self.frame = rect;
}
- (CGFloat)y{
    return self.frame.origin.y;
}

- (void)setY:(CGFloat)y{
    CGRect rect = self.frame;
    rect.origin.y = y;
    self.frame = rect;
}
- (CGFloat)w{
    return self.frame.size.width;
}

- (void)setW:(CGFloat)w{
    CGRect rect = self.frame;
    rect.size.width = w;
    self.frame = rect;
}
- (CGFloat)h{
    return self.frame.size.height;
}

- (void)setH:(CGFloat)h{
    CGRect rect = self.frame;
    rect.size.height = h;
    self.frame = rect;
}
@end
